package com.yiwangqingshui.many.cglib;

import com.yiwangqingshui.many.cglib.demo.DemoDao;
import com.yiwangqingshui.many.cglib.demo.DemoDaoInterface;
import com.yiwangqingshui.many.cglib.demo.ProxyDemo;
import com.yiwangqingshui.many.cglib.demo.ProxyIntDemo;
import net.sf.cglib.proxy.Enhancer;

/**
 * @author smc
 * @date 2019-02-22 13:44
 * @since
 **/
public class CglibMainDemoInt {

    public static void main(String[] args) {

        Enhancer enhancer = new Enhancer();

        ProxyIntDemo proxyDemo = new ProxyIntDemo();

        enhancer.setCallback(proxyDemo);

        enhancer.setSuperclass(DemoDaoInterface.class);

        DemoDaoInterface demoDao = (DemoDaoInterface) enhancer.create();

        System.out.println(demoDao.say("hellworld"));


    }

}
